Attribute VB_Name = "modVWE"
'#Region "API CONSTANTS"

    'Constant used in image capturing

    Public Const SRCCOPY As Long = &HCC0020

    'Constants used in video streaming
    Public Const WS_CHILD As Long = &H40000000

    Public Const WS_VISIBLE As Long = &H10000000

    Public Const SWP_NOMOVE As Long = &H2

    Public Const SWP_NOZORDER As Long = &H4

    Public Const WM_USER As Long = &H400

    Public Const WM_CAP_DRIVER_CONNECT As Long = WM_USER + 10

    Public Const WM_CAP_DRIVER_DISCONNECT As Long = WM_USER + 11

    Public Const WM_CAP_SET_VIDEOFORMAT As Long = WM_USER + 45

    Public Const WM_CAP_SET_PREVIEW As Long = WM_USER + 50

    Public Const WM_CAP_SET_PREVIEWRATE As Long = WM_USER + 52

    Public Const WM_CAP_START As Long = WM_USER

    Public Const WM_CAP_DRIVER_GET_NAME As Long = (WM_CAP_START + 12)

    Public Const WM_CAP_DRIVER_GET_VERSIONA As Long = (WM_CAP_START + 13)

    Public Const WM_CAP_DLG_VIDEOSOURCE As Long = (WM_CAP_START + 42)

    Public Const WM_CAP_ABORT As Long = (WM_CAP_START + 69)

    Public Const WM_CAP_STOP As Long = (WM_CAP_START + 68)

    Public Const WM_CAP_GRAB_FRAME As Long = (WM_CAP_START + 60)

    Public Const WM_CAP_GRAB_FRAME_NOSTOP As Long = (WM_CAP_START + 61)

    Public Const WM_CAP_FILE_SAVEDIBA As Long = (WM_CAP_START + 25)

    Public Const WM_CAP_EDIT_COPY As Long = (WM_CAP_START + 30)

    Public Const WM_CAP_GET_MCI_DEVICEA As Long = (WM_CAP_START + 67)

    Public Const WM_CAP_SET_MCI_DEVICEA As Long = (WM_CAP_START + 66)

    Public Const WM_CAP_DRIVER_GET_CAPS As Long = (WM_CAP_START + 14)

'#End Region

'#Region "API TYPES"
    'Types used in video streaming
Public Type BITMAPINFOHEADER
    biSize As Long
    biWidth As Long
    biHeight As Long
    biPlanes As Integer
    biBitCount As Integer
    biCompression As Long
    biSizeImage As Long
    biXPelsPerMeter As Long
    biYPelsPerMeter As Long
    biClrUsed As Long
    biClrImportant As Long
End Type



Public Type CAPDRIVERCAPS
    wDeviceIndex As Long '               // Driver index in system.ini
    fHasOverlay As Long '                // Can device overlay?
    fHasDlgVideoSource As Long '         // Has Video source dlg?
    fHasDlgVideoFormat As Long '         // Has Format dlg?
    fHasDlgVideoDisplay As Long '        // Has External out dlg?
    fCaptureInitialized As Long '        // Driver ready to capture?
    fDriverSuppliesPalettes As Long '    // Can driver make palettes?
    hVideoIn As Long '                   // Driver In channel
    hVideoOut As Long '                  // Driver Out channel
    hVideoExtIn As Long '                // Driver Ext In channel
    hVideoExtOut As Long '               // Driver Ext Out channel
End Type

Public Type CAPSTATUS
    uiImageWidth As Long                    '// Width of the image
    uiImageHeight As Long                   '// Height of the image
    fLiveWindow As Long                     '// Now Previewing video?
    fOverlayWindow As Long                  '// Now Overlaying video?
    fScale As Long                          '// Scale image to client?
    ptScroll As PointAPI                    '// Scroll position
    fUsingDefaultPalette As Long            '// Using default driver palette?
    fAudioHardware As Long                  '// Audio hardware present?
    fCapFileExists As Long                  '// Does capture file exist?
    dwCurrentVideoFrame As Long             '// # of video frames cap'td
    dwCurrentVideoFramesDropped As Long     '// # of video frames dropped
    dwCurrentWaveSamples As Long            '// # of wave samples cap'td
    dwCurrentTimeElapsedMS As Long          '// Elapsed capture duration
    hPalCurrent As Long                     '// Current palette in use
    fCapturingNow As Long                   '// Capture in progress?
    dwReturn As Long                        '// Error value after any operation
    wNumVideoAllocated As Long              '// Actual number of video buffers
    wNumAudioAllocated As Long              '// Actual number of audio buffers
End Type

Public Type CAPTUREPARMS
    dwRequestMicroSecPerFrame As Long       '// Requested capture rate
    fMakeUserHitOKToCapture As Long         '// Show "Hit OK to cap" dlg?
    wPercentDropForError As Long            '// Give error msg if > (10%)
    fYield As Long                          '// Capture via background task?
    dwIndexSize As Long                     '// Max index size in frames (32K)
    wChunkGranularity As Long               '// Junk chunk granularity (2K)
    fUsingDOSMemory As Long                 '// Use DOS buffers?
    wNumVideoRequested As Long              '// # video buffers, If 0, autocalc
    fCaptureAudio As Long                   '// Capture audio?
    wNumAudioRequested As Long              '// # audio buffers, If 0, autocalc
    vKeyAbort As Long                       '// Virtual key causing abort
    fAbortLeftMouse As Long                 '// Abort on left mouse?
    fAbortRightMouse As Long                '// Abort on right mouse?
    fLimitEnabled As Long                   '// Use wTimeLimit?
    wTimeLimit As Long                      '// Seconds to capture
    fMCIControl As Long                     '// Use MCI video source?
    fStepMCIDevice As Long                  '// Step MCI device?
    dwMCIStartTime As Long                  '// Time to start in MS
    dwMCIStopTime As Long                   '// Time to stop in MS
    fStepCaptureAt2x As Long                '// Perform spatial averaging 2x
    wStepCaptureAverageFrames As Long       '// Temporal average n Frames
    dwAudioBufferSize As Long               '// Size of audio bufs (0 = default)
    fDisableWriteCache As Long              '// Attempt to disable write cache
End Type

   
'    Public Type POINTAPI
'        x As Long
'        y As Long
'    End Type


    Public Type BITMAPINFO

        bmiHeader As BITMAPINFOHEADER

        bmiColors() As Integer

    End Type

'#End Region

'#Region "API DECLARATIONS"
    'API's Used in video streaming
   
    Public Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
    Public Declare Function capGetDriverDescription Lib "avicap32.dll" Alias "capGetDriverDescriptionA" (ByVal wDriverIndex As Long, ByVal lpszName As String, ByVal cbName As Long, ByVal lpszVer As String, ByVal cbVer As Long) As Long

    Public Declare Function SendMessageAsBitMap Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As BITMAPINFO) As Long

    Public Declare Function SendMessageAsDrvCap Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As CAPDRIVERCAPS) As Long

    Public Declare Function SendMessageAsCapStatus Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As CAPSTATUS) As Long

    Public Declare Function SendMessageAsCapParams Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As CAPTUREPARMS) As Long

    Public Declare Function SendMessageAsString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As String) As Long

    Public Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, ByVal hWndParent As Long, ByVal nID As Long) As Long
    Public Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Integer, ByVal lpszName As String, ByVal cbName As Long, ByVal lpszVer As String, ByVal cbVer As Long) As Boolean
   
    'Public Declare Function capDriverGetName Lib "avicap32.dll" (ByVal hWnd As Long, ByVal szName As String, ByVal wSize As Long)
    'API's used in image capturing
    Public Declare Function BitBlt Lib "gdi32.dll" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

    Public Declare Function GetWindowDC Lib "user32.dll" (ByVal hwnd As Long) As Long

    Public Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long

'#End Region
